<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/template/layout2.xhtml">
	<ui:define name="conteudo">
		<br />
		<br />
		<div id="path">
			<h1>Cadastro Prova</h1>
			<hr />

		</div>

		<h:form>
			<br />
			<br />
			<br />
			<p:messages autoUpdate="true"/>
			<fieldset>
				<legend>Dados</legend>
				<br /> <br />
				<h:panelGrid columns="3">
					<h:outputLabel value="Nome do Concurso:" for="nomeconcurso"
						styleClass="label" />
					<h:inputText id="nomeconcurso" class="rotulos" size="70"
						value="#{provaBean.prova.nome}" required="true"
						requiredMessage="* O campo [Nome do Concurso] é obrigatório!" />
					<h:message for="nomeconcurso" showSummary="true" showDetail="false"
						class="error" />

					<h:outputLabel value="Tipo de Prova:" for="tipoprova" />
					<h:selectOneMenu id="tipoprova" value="#{provaBean.prova.tipo}"
						required="true"
						requiredMessage="* O campo [Categoria] é obrigatório!">
						<f:selectItems value="#{tipoDeProvaBean.listarprovas}"
							var="#{tipoprova}" itemValue="#{tipoprova}" />
						<f:converter converterId="simpleEntityConverter" />
					</h:selectOneMenu>
					<a></a>
					<h:outputLabel value="Cargo:" for="cargo" styleClass="label" />
					<h:inputText id="cargo" class="rotulos" size="40"
						value="#{provaBean.prova.cargo}" required="true"
						requiredMessage="* O campo [Cargo] é obrigatório!" />
					<h:message for="cargo" showSummary="true" showDetail="false"
						class="error" />

					<h:outputLabel value="Banca:" for="banca" styleClass="label" />
					<h:inputText id="banca" class="rotulos" size="40"
						value="#{provaBean.prova.banca}" />
					<br />

					<h:outputLabel value="Ano:" for="ano" styleClass="label" />
					<h:inputText id="ano" class="rotulos"
						value="#{provaBean.prova.ano}" required="true"
						requiredMessage="* O campo [Ano] é obrigatório!" />
					<h:message for="ano" showSummary="true" showDetail="false"
						class="error" />
				</h:panelGrid>
				<br /> <br />
				<h:commandButton class="botaolimpar" value="Limpar"
					image="../resources/imagens/botoes/botao-limpar.png"
					immediate="true">
					<f:ajax render="@form"></f:ajax>
				</h:commandButton>
				<h:commandButton class="botaosalvar" value="Salvar"
					image="../resources/imagens/botoes/botao-salvar.png"
					action="#{provaBean.actionCadastrar}"></h:commandButton>
			</fieldset>
		</h:form>
		<div><br/></div>
		<h:form>
			<h:dataTable  styleClass="tabela" headerClass="cabecalho" columnClasses="ultimo,primeiro" value="#{provaBean.provas}" var="prova">
				<h:column>
					<f:facet name="header"> 
						<h:outputText value="Nome" />
		            </f:facet>
					<h:outputText value="#{prova.nome}" />
				</h:column>
				<h:column>
					<f:facet name="header">  
	                 	<h:outputText value="Banca" />
		            </f:facet>
					<h:outputText value="#{prova.banca}" />
				</h:column>
				<h:column>
					<f:facet name="header">  
		                 <h:outputText value="Cargo" />
		            </f:facet>
					<h:outputText value="#{prova.cargo}" />
				</h:column>
				<h:column>
					<f:facet name="header">  
		                 	 <h:outputText value="Ano" />
		            </f:facet>
					<h:outputText value="#{prova.ano}" />
				</h:column>
				<h:column>
					<f:facet name="header">  
		                 	 <h:outputText value="Tipo" />
		            </f:facet>
					<h:outputText value="#{prova.tipo.nome}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						 <h:outputText value="Ação" />
					</f:facet>

					<h:commandLink value="" action="#{provaBean.actionRemover}"
						title="Remover">
						<f:setPropertyActionListener target="#{provaBean.prova}"
							value="#{prova}" />
							<h:graphicImage library="imagens" name="ic_remover.gif" />
					</h:commandLink>
					<h:commandLink value="" title="Alterar">
						<f:setPropertyActionListener target="#{provaBean.prova}"
							value="#{prova}" />
							<h:graphicImage library="imagens" name="editar.png" />
					</h:commandLink>
					<h:commandLink value="" action="#{questoesBean.cadastroQuestoes}"
						title="Adicionar Questões">
						<f:setPropertyActionListener target="#{questoesBean.prova}"
							value="#{prova}" />
							<h:graphicImage library="imagens" name="ic_addquestoes.jpg" />
					</h:commandLink>


				</h:column>

			</h:dataTable>
		</h:form>
	</ui:define>
</ui:composition>
</html>